import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询商品订单列表
export function listOrderGoods(data) {
  return request({
    url: '/order/goods/orderGoodsList',
    method: 'post',
    data: data
  })
}

// 查询商品订单详细
export function getOrderGoods(OrderNo) {
  return request({
    url: '/order/goods/' + parseStrEmpty(OrderNo),
    method: 'get'
  })
}

// 新增商品订单
export function addOrderGoods(data) {
  return request({
    url: '/order/goods',
    method: 'post',
    data: data
  })
}

// 管理员取消商品订单
export function adminCancelOrderGoods(data) {
  return request({
    url: '/order/goods/adminCancelOrderGoods',
    method: 'post',
    data: data
  })
}

// 修改商品订单
export function updateOrderGoods(data) {
  return request({
    url: '/order/goods',
    method: 'put',
    data: data
  })
}

// 删除商品订单
export function delOrderGoods(OrderNo) {
  return request({
    url: '/order/goods/' + OrderNo,
    method: 'delete'
  })
}

// 商品订单状态修改
export function changeOrderGoodsStatus(OrderNo, status) {
  const data = {
    OrderNo,
    status
  }
  return request({
    url: '/order/goods/orderGoodsChangeStatus',
    method: 'put',
    data: data
  })
}

// 完成商品订单
export function finishOrderGoods(data) {
  return request({
    url: '/order/goods/finishOrderGoods',
    method: 'post',
    data: data
  })
}